package com.example.demo.service;

import com.example.demo.dao.UsersRepository;
import com.example.demo.entity.Users;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by Administrator on 2018-4-24.
 */
@Service
public class UsersService {
    @Autowired
    private UsersRepository userRepository;

    @Transactional(propagation = Propagation.REQUIRED)
    public Users save(Users users) {
        return userRepository.save(users);
    }
    @Transactional(propagation = Propagation.NOT_SUPPORTED)
    public List<Users> findAll() {
        return userRepository.findAll();
    }

}
